package Controller.TimerTasks;



import com.intouchtv.ari.NabDemoView;

import model.Movie;
import model.MovieEvent;
import model.Result;
import Controller.GameController;


public class EndEventTimerTask extends MovieTimerTask {
	
	
	public EndEventTimerTask(MovieEvent event, NabDemoView view,
			Movie currentMovie, GameController controller) {
		super(event, view, currentMovie,controller);
	}

	@Override
	public void run() {
		//first check if we need to activate the no result
		if(!event.getIsResultYes())
		{
			controller.removeEventElement(event);
			
			for (Result result : event.getResultNo()) {
				try {
					controller.performResult(event.getId(),result);
				} catch (Exception e) {
					controller.raiseErrorMessage(e.getMessage());
				}
			}
			
		}

	}

}
